<template>
  <video id="video-webrtc" ref="videowebrtc" controls></video>
</template>

<script>
import jswebrtc from '../webRTC/jswebrtc.min.js'

export default {
  name: 'webRTCplay',
  data() {
    return {
      videowebrtc: null,
    }
  },
  props: {
    url: {
      type: String,
      default: '',
    },
    //g: String,
  },
  //初始化
  mounted() {
    this.playX()
  },
  computed: {},
  methods: {
    playX() {
      const videoElement = this.$refs.videowebrtc
      const player = new jswebrtc.Player(this.url, {
        video: videoElement,
        autoplay: true,
        onPlay: obj => {
          console.log('start play livestream')
        },
      })
    },
  },
}
</script>

<style scoped lang="scss">
</style>
